#!/usr/bin/env bash
. wvtest-bup.sh || exit $?
. dev/lib.sh || exit $?

set -o pipefail

top="$(WVPASS pwd)" || exit $?
tmpdir="$(WVPASS wvmktempdir)" || exit $?
export BUP_DIR="$tmpdir/bup"

bup() { "$top/bup" "$@"; }

WVPASS cd "$tmpdir"

WVSTART 'main'

bup
rc=$?
WVPASSEQ "$rc" 2

# Check --x=y handling
WVPASS bup --bup-dir=repo init

WVPASS cd "$top"
WVPASS rm -r "$tmpdir"
